package model;

import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;

public class ConstantDeclared implements StatementKind{
//	private final Class<?> clazz;
	private final Field constant;
	public ConstantDeclared(Field constant){
		this.constant= constant;
	}
	  public static ConstantDeclared getField(Field field) {
		    return new ConstantDeclared(field);
		  }

	  public String convertString(){
		  return this.toString1(this.constant);
	  }
	  @Override
	  public String toString() {
	    return convertString();
	  }
	  public Field getConstant() {
		  return this.constant;
	  }
	  public Class<?> getOutputType() {
		  return this.constant.getType();
	  }
	  public  String toParseableString(Map<String,Class<?>> classesToTest){
		  if(classesToTest.containsKey(this.constant.getDeclaringClass().getName()))
			 	return toString1(this.constant);		
		 return null;


	  }
	  public List<Class<?>> getInputTypes() {
		  return null;
	  }
	  public  String toString1(Field f) {
		     StringBuilder sb = new StringBuilder();
		     sb.append(f.getType()+" " +f.getName() + " = ");
		     sb.append(f.getDeclaringClass().getName().toString()+ "."+ f.getName()+"\n");		     
		     return sb.toString();
		   }
      public  List<Class<?>> getGenericInputRetrnTypes(){
          return null;
  }
}
